Quartz, Bug 655057: Eliminate Compiler Warning
authorAlex Corrado <alexander.corrado@gmail.com>
Sun, 9 Oct 2011 16:52:14 +0000 (09:52 -0700)
committerJohn Ralls <jralls@ceridwen.us>
Sun, 9 Oct 2011 17:18:40 +0000 (10:18 -0700)
When compiled with older SDKs, the original change for this bug caused a
compiler warning about NSWindow not being able to handle a setStyleMask
message. This tricks the compiler into thinking that it can.

gdk/quartz/gdkwindow-quartz.c

index 9bd104dfbabe51fc040bb3e16da834e91ce86663..82e79dc73d4645bcb2fee6cb895afe4ab5c286b5 100644 (file)
@@ -2530,9 +2530,17 @@ gdk_quartz_window_get_frame_extents (GdkWindow    *window,
   rect->height = ns_rect.size.height;
 }
 
+/* Fake protocol to make gcc think that it's OK to call setStyleMask
+   even if it isn't. We check to make sure before actually calling
+   it. */
+
+@protocol CanSetStyleMask
+- (void)setStyleMask:(int)mask;
+@end
+
 static void
 gdk_quartz_window_set_decorations (GdkWindow       *window,
-                                   GdkWMDecoration  decorations)
+                           GdkWMDecoration  decorations)
 {
   GdkWindowImplQuartz *impl;
   NSUInteger old_mask, new_mask;
@@ -2589,7 +2597,7 @@ gdk_quartz_window_set_decorations (GdkWindow       *window,
        */
       if ([impl->toplevel respondsToSelector:@selector(setStyleMask:)])
         {
-          [impl->toplevel setStyleMask:new_mask];
+          [(id<CanSetStyleMask>)impl->toplevel setStyleMask:new_mask];
         }
       else
         {